import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import map from '../views/map.vue'
import p111 from '../views/pages/p111'
import p211 from '../views/pages/p211'
import p212 from '../views/pages/p212'
import p213 from '../views/pages/p213'
import p221 from '../views/pages/p221'
import p222 from '../views/pages/p222'
import p231 from '../views/pages/p231'
import p241 from '../views/pages/p241'
import p242 from '../views/pages/p242'
import p251 from '../views/pages/p251'
import p311 from '../views/pages/p311'
import p321 from '../views/pages/p321'
import About from '../views/About'
Vue.use(VueRouter)

const routes = [
  {
    path: '/print',
    name: 'Home',
    component:Home
  },
  {
    path: '/map',
    name: 'map',
    component:map
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: About
  },
  {
    path:'/p111',
    name:'p111',
    component:p111
  },
  {
    path:'/p211',
    name:'p211',
    component:p211
  },
  {
    path:'/p212',
    name:'p212',
    component:p212
  },
  {
    path:'/p213',
    name:'p213',
    component:p213
  },
  {
    path:'/p221',
    name:'p221',
    component:p221
  },
  {
    path:'/p222',
    name:'p222',
    component:p222
  },
  {
    path:'/p231',
    name:'p231',
    component:p231
  },
  {
    path:'/p241',
    name:'p241',
    component:p241
  },
  {
    path:'/p242',
    name:'p242',
    component:p242
  },
  {
    path:'/p251',
    name:'p251',
    component:p251
  },
  {
    path:'/p311',
    name:'p311',
    component:p311
  },
  {
    path:'/p321',
    name:'p321',
    component:p321
  },
]


const router = new VueRouter({
  routes
})

// router.beforeEach((to, from, next) => {
//   // ...
//   console.log(to,from);
//   // if (to.name !== 'Login') next({ name: 'Login' })
//   // else next()
//   console.log('next',next);
  
// })

router.afterEach((to, from) => {
  // ...
  console.log(to);
  console.log(from); 
  
})

export default router
